<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>绿地养护</title>
	<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<link rel="stylesheet" type="text/css" href="./css/api.css" />
	<link rel="stylesheet" type="text/css" href="./css/globle.css" />
	<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css" />
	<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	<link rel="stylesheet" type="text/css" href="./css/common.css" />
	<link rel="stylesheet" type="text/css" href="./css/layui.css" />
	<link rel="stylesheet" type="text/css" href="./css/admin.css" />
	<style>
		body {
			/* padding-top: 25px; */
		}

		span {
			margin: 10px;
		}

		.Tabl {
			height: 10px;
			width: 88%;
			font-size: 14px;
			/*font-weight: bold;*/
			text-align: left;
			margin-left: 6%;
		}

		.Td1 {
			color: #B8B8B8;
			width: 70px;
		}

		.Td2 {
			color: #000000;
			text-align: left;
			width: 84px;
		}

		.Hr {
			/*height: 1px;*/
			/*width: 90%;*/
			/*background-color: #B8B8B8;*/
			background-color: #DDDDDD;
			margin-left: 2%;
		}

		.Butt {
			border: 1px solid #B8B8B8;
			border-radius: 20px;
			color: #FFFFFF;
			height: 17px;
			width: 17px;
			outline: none;
		}

		.TabImg {
			height: 150px;
			width: 96%;
			margin-left: 2%;
			border: 10px solid #D8D8D8;
		}

		.TdImg1 {
			height: 110px;
			width: 90px;
		}

		.TdImg2 {
			height: 110px;
			width: 90px;
		}

		.ButAdd {
			height: 110px;
			width: 100px;
			font-size: 100px;
			color: #FFFFFF;
			background-color: #B8B8B8;
		}

		.TabL {
			height: 75px;
			width: 88%;
			font-size: 16px;
			font-weight: bold;
			text-align: left;
			margin-left: 6%;
		}

		.ButL {
			height: 40px;
			width: 100%;
			background-color: #1abc9c;
			position: fixed;
			bottom: 0;
		}

		.Td3 {
			text-align: center;
			width: 50%;
		}

		select {
			appearance: none;
			-moz-appearance: none;
			-webkit-appearance: none;
			border: none;
			background: none;
		}
	</style>
</head>

<body>
	<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 15px;">
		<form class="layui-form layui-form-pane" action="">

			<div class="layui-form-item">
				<label class="layui-form-label">公司名称</label>
				<div class="layui-input-inline">
					<input type="text" name="name" id="name" lay-verify="required" placeholder="请输入公司名称" autocomplete="off"
						class="layui-input">
				</div>
				<label class="layui-form-label">联系人</label>
				<div class="layui-input-inline">
					<input type="text" name="lxr" id="lxr" lay-verify="required" placeholder="请输入联系人" autocomplete="off"
						class="layui-input">
				</div>
				<label class="layui-form-label">联系电话</label>
				<div class="layui-input-inline">
					<input type="tel" name="tel" id="tel" lay-verify="required" placeholder="请输入联系电话" autocomplete="off"
						class="layui-input">
				</div>
				<label class="layui-form-label">企业邮箱</label>
				<div class="layui-input-inline">
					<input type="email" name="youxiang" id="youxiang" lay-verify="required" placeholder="请输入企业邮箱"
						autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">企业网址</label>
				<div class="layui-input-inline">
					<input type="text" name="enurl" id="enurl" lay-verify="required" placeholder="请输入企业网址" autocomplete="off"
						class="layui-input">
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">希望通过智慧园林软件能达到的目标是？</label>
				<div class="layui-input-block">
					<textarea placeholder="请输入内容" class="layui-textarea" id="ddmd" name="ddmd"></textarea>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">上传营业执照</label>
				<div style="padding: 10px;">
					<ul class="upload-ul clearfix">
						<li class="upload-pick" id="upload-pick">
							<div class="webuploader-container clearfix" id="goodsUpload"></div>
						</li>
					</ul>
				</div>
			</div>
		</form>
	</div>
	<table class="ButL">
		<tr>
			<td class="Td3">
				<div style="color:#FFFFFF" id="sublmt">
					提交
				</div>
			</td>
		</tr>
	</table>
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript" src="./script/layui.js"></script>
<script src="./script/webuploader.min.js"></script>
<script src="./script/diyUpload.js"></script>
<script type="text/javascript" src="./script/common.js"></script>
<script type="text/javascript" src="./script/vue.js"></script>
<script type="text/javascript">
	apiready = function () {
		/* 		var $tgaUpload = $('#goodsUpload').diyUpload({
					url: BaseServiceUrl + "mobile/mainten/uploudfile.json",

					success: function (data) {
						alert(JSON.stringify(data))
					},
					error: function (err) {
						alert(JSON.stringify(err))
					},
					buttonText: '',
					accept: {
						title: "Images",
						extensions: 'gif,jpg,jpeg,bmp,png'
					},
					thumb: {
						width: 130,
						height: 130,
						quality: 130,
						allowMagnify: true,
						crop: true,
						type: "image/jpeg"
					}
				});
				$tgaUpload.options.formData.dids = null;
		 */
		var zz = null;
		$("#goodsUpload").on('click', function () {

			api.getPicture({
				sourceType: 'album',
				encodingType: 'png',
				mediaValue: 'pic',
				destinationType: 'url',
				allowEdit: true,
				//	quality: 100,
				targetWidth: 300,
				targetHeight: 300,
				saveToPhotoAlbum: false
			}, function (ret, err) {
				if (ret) {
					//alert(JSON.stringify(ret));
					zz = ret.data;
					$("#upload-pick").css("background", "url(" + ret.data + ") no-repeat")
				} else {
					alert(JSON.stringify(err));
				}
			});

		})


		$("#sublmt").click(function () {
			var formData = new FormData();
			var obj = {
				name: $("#name").val(),
				lxr: $("#lxr").val(),
				tel: $("#tel").val(),
				youxiang: $("#youxiang").val(),
				enurl: $("#enurl").val(),
				ddmd: $("#ddmd").val(),
			};
			formData.append("data", JSON.stringify(obj));

			formData.append("file", zz);

			// 表单方式提交数据或文件
			api.ajax({
				url: serverIP + 'mobile/ontrial/update.jhtml',
				method: 'post',
				data: {
					values: {
						data: JSON.stringify(obj)
					},
					files: {
						file: zz
					}
				}
			}, function (ret, err) {
				if (ret.code === 0) {
					api.closeWin();
				} else {
					alert("提交失败，请检查网络")
				}
			});
			/* api.ajax({
				url: serverIP + 'mobile/ontrial/update.jhtml',
				type: "post",
				data: formData,
				processData: false,
				contentType: false,
				success: function (data) {
					if (data.code === 0) {
						api.closeWin();
					} else {

					}
				},
				error: function (jqXHR, textStatus, errorThrown) {
					console.log(JSON.stringify(jqXHR))
					console.log(textStatus)
					console.log(errorThrown)
				}
			}) */
		})

	}
</script>

</html>